package cc.idoone.spring_boot_hello.amqp.direct;

import org.springframework.stereotype.Component;

import java.util.concurrent.CountDownLatch;

/**
 * @author hemj
 * @since 2017/10/15
 */
@Component
public class Receiver {

	private CountDownLatch latch = new CountDownLatch(1);

	public void receiveMessage(String message) {
		System.out.println("Received <" + message + ">");
		latch.countDown();
		//若有异常，则下回接收继续处理
		//throw new IllegalArgumentException("接收异常");
	}

	public CountDownLatch getLatch() {
		return latch;
	}

}
